<?php 
session_start();
require_once("include/authen.php");
require_once("include/ui.php");

if ($_SESSION["permission"][$productScreen]["View"]=="0"){
	echo "<script>alert('".$no_permit."');</script>";
	echo "<meta http-equiv = refresh ; content = '0 ; url = mainscreen.php'>";
	exit();
}
// show header
echo headerPage("Product Maintenance");
?> 
<SCRIPT src="js/js_product.js"></SCRIPT> 
<script>
$(function() {
	$("#Price,#Commission, #nurCommission, #docCommission").keypress(function(e){
		
		if(e.which!=46 && e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)){
			return false;
		}
	});
	$("#Scale, #Amount,#Times,#LimitNumber").keypress(function(e){
		
		if( e.which!=8 && e.which!=0 && (e.which<48 || e.which>57)){
			return false;
		}
	});
		$( "#txtDateTo" ).datepicker({ dateFormat: 'dd/mm/yy',
		showOn: "button",
		buttonImage: "images/Calendar.png",
		buttonImageOnly: true });
		$("#btnPrint").live('click',function(){
		$("#normal-screen").hide();
		$("#page-header").hide();
		$("#searchdata").hide();
		$(".toolbar-box").hide();
		$("#foolter_table").hide();
		$("#leftboder").hide();
		$("#rightboder").hide();
		
		window.print();
		
		$("#normal-screen").show();
		$("#page-header").show();
		$("#searchdata").show();
		$(".toolbar-box").show();
		$("#foolter_table").show();
		$("#leftboder").show();
		$("#rightboder").show();
	});	
});
</script>
<FORM name="Act" action="<?php echo $PHP_SELF?>" method="post"> 
<INPUT type=hidden value="add" id="mode" name="mode"> 
<INPUT type=hidden value="Admin" id="user" name="user"> 

<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10" id='leftboder' style="border-left:2px solid #facb0c;">&nbsp;</td>
    <td width="1004" valign="top">
        <div class="content-box">
            <div Class="toolbar-box">   
                <div class="t">
                    <div class="t">
                        <div class="t"></div>
                    </div>
                 </div>
                 <div class="m">
                    <div class="toolbar">
                        <table class="toolbar">
                        <tr>
                            <td>
						<?php  if ($_SESSION["permission"][$productScreen]["Add"]=="1") {?>
								<a href="javascript:void('0');" id="btnAdd">
								<span class="icon_add"></span>Add
								</a>
							<?php }?>
							</td>
							  <td>
								<a href="javascript:void('0');" title="Print" id="btnPrint">
								<span class="icon_Print"></span>Print
								</a>
							</td>
                        </tr>
                        </table>
                    </div>
                      <div class="header" style="background-image: url(images/package.png);">
                        Product Maintenance
                      </div>
                <div class="clr"></div>
                 </div>
                 <div class="b">
                    <div class="b">
                        <div class="b"></div>
                    </div>
                 </div>
            </div>
               <div id="element-box">
                <div class="t">
					<div class="t">
						<div class="t"></div>
					</div>
				</div>
                <div class="m">
                    <table width="100%" id='searchdata'>
                        <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">Product Name : </td>
									<td width="85%" align=left >
									<input id="txtProductName_s"  title="Filter by product name "  type="text"  size=40 name="txtProductName_s" class="boxItem" />
									</td>
                         </tr>
						       <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">Product Type : </td>
							<td width="85%" align=left >
								<select name="cboType" style="width:10em;"  id="cboType">
								</select>
							</td>
                         </tr>
						  <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">Category : </td>
							<td width="85%" align=left >
								<select name="cboCategory" style="width:10em;"  id="cboCategory">
								</select>
							</td>
                         </tr>
						 <tr><td/><td>
						 <a href="javascript:void('0');" id="btnSearch"><img src="./images/btn-search.gif" border=0/></a> </td></tr>
						 <tr><td colspan="2"></tr>
                    </table>
                    <table cellspacing="1" id="resultData" class=list>
                    <thead>
                       <tr>
						<th width="3%">No</th>
							<th style='display:none'>ID</th>
							<th class="title" width="22%">Name</th>
							<th  class="title" width="20%" nowrap="nowrap">Category</th>
							<th  class="title" width="10%" nowrap="nowrap">Product Type</th>
							<th  class="title" width="10%" nowrap="nowrap">Main Unit</th>
							<th  class="title" width="10%" nowrap="nowrap">Price</th>
							<th  class="title" width="10%" nowrap="nowrap">Commission</th>
							<th style="display:none"  class="title" width="5%" nowrap="nowrap">View</th>
							<th  class="title" width="5%" nowrap="nowrap">Edit</th>
							<th  class="title" width="5%" nowrap="nowrap">Del</th>
                      </tr>
                    </thead>
                   <tbody>
                     </tbody>
                     <tfoot>
                         <tr>
                            <td colspan="10">
								<div class="boxfooter">
							 	<div id="paging_btn"> </div>
								 <div class="totalpage">Total : <span id="rowCount">0</span>&nbsp;&nbsp;rows</div>
								 </div>
								 
							</td>
                         </tr>
                     </tfoot>
                    </table>
                  <div class="clr"></div>
                </div>
                 <div class="b"><div class="b"><div class="b"></div></div></div>
                 <div class="clr"></div>
                </div> <!-- elementbox-->
        </div>
    </td>
    <td width="10" id='rightboder' style="border-right:2px solid #facb0c;">&nbsp;</td>
  
  </tr>
</table>
 </FORM>
 
<div id="dialog-confirm" title="Confirm delete?" style="padding-top:20px;">
	<p style="font-size:13px"><span class="ui-icon ui-icon-alert" 
		style="float:left; margin:0 7px 20px 0;">
		</span>Are you sure this product?</p>
</div>
<div id="dialog-form" >
	<p class="validateTips">* fields are required.</p>
	<form>
	<table cellpadding="3" cellspacing="0" border="0" width="100%" class="fieldset">
		<tr>
			<td width="30%"><label for="name" >Prdocut Type : *</label></td>
			<td width="70%">
			<select id="ProductType" style="width:20em;font-size:12px"  class="ui-widget ui-widget-content ui-corner-left" /></td>
		</tr>
		<tr>
			<td width="30%"><label for="name" >Product Name : *</label></td>
			<td width="70%"><input type="text" name="ProductName"  id="ProductName" class="text ui-widget-content ui-corner-all" /></td>
		</tr>
		<tr>
			<td width="30%"><label for="name" >Category : *</label></td>
			<td width="70%">
				<select name="Category" style="width:20em;font-size:12px;"
						class="ui-widget ui-widget-content ui-corner-left" id="Category"  />
				</td>
		</tr>
		<tr>
			<td width="30%"><label for="name" >Main Unit :</label></td>
			<td width="70%">
			<select name="MainUnit" style="width:6em;font-size:12px;"  id="MainUnit" class="ui-widget ui-widget-content ui-corner-left" />
			</td>
		</tr>
		<tr class="subUnit_hide">
			<td width="30%"><label for="name" >Sub Unit :</label></td>
			<td width="70%">
				<select  name="SubUnit"   id="SubUnit" class="ui-widget ui-widget-content ui-corner-left" style="width:6em;font-size:12px;"></select>
				&nbsp;<label for="name" >Scale :</label>&nbsp;
				<input type="text" name="Scale" id="Scale" class="ui-widget-content ui-corner-all" style="width:7em;padding:3px;font-size:12px;"  />
			</td>
		</tr>
		<tr  class="product_cost">
			<td width="30%"><label for="name" >Cost :</label></td>
			<td width="70%">
				<input type="text" name="Cost_Price"  id="Cost_Price" class="text ui-widget-content ui-corner-all"  disabled />
			</td>
		</tr>
		<tr  class="cost_on_branch">
			<td width="30%"><label for="name" >Cost Of Branch :</label></td>
			<td width="70%">
				<input type="text" name="Cost_branch"  id="Cost_branch" class="text ui-widget-content ui-corner-all"  />
			</td>
		</tr>		
		<tr>
			<td width="30%"><label for="name" >Price :</label></td>
			<td width="70%">
				<input type="text" name="Price"  id="Price" class="text ui-widget-content ui-corner-all" />
			</td>
		</tr>
	
		<tr  class="pos_hide">
			<td><label for="status">Product in POS </label></td>
			<td><input type="checkbox" name="IsPOS" id="IsPOS" value="" checked /><label for="status">Yes</label></td>
		</tr>
		<tr  class="stock_hide">
			<td><label for="status">Stock </label></td>
			<td><input type="checkbox" name="IsStock" id="IsStock" value="" checked /><label for="status">Yes</label></td>
		</tr>
		<tr  class="premium_hide">
			<td><label for="status">Premium </label></td>
			<td><input type="checkbox" name="IsPremium" id="IsPremium" value=""  /><label for="status">Yes</label></td>
		</tr>		
		<tr  class="LimitAmount">
			<td><label for="status">Minimum limit </label></td>
			<td><input type="text" name="LimitNumber" value="5"  id="LimitNumber" class="text ui-widget-content ui-corner-all" style="width:7em;" /></td>
		</tr>
		 <tr class="userCommission">
			<td width="30%"><label for="name" >Commission :</label></td>
			<td width="70%">
				<input type="text" name="Commission"  maxlength=3   id="Commission" class="text ui-widget-content ui-corner-all" style="width:5em;text-align:left;" />
				<select  name="CommissionType"   id="CommissionType" class="ui-widget ui-widget-content ui-corner-left" style="width:6em;font-size:12px;">
					<option value="0">BAHT</option>
					<option value="1">%</option>
				</select>
			</td>
		</tr>	
		<tr class="Times_hide">
			<td width="30%"><label for="name" >Times :</label></td>
			<td width="70%">
			<input type="text" name="Times"  id="Times" class="text ui-widget-content ui-corner-all" />
			</td>
		</tr>
		<tr>
		<td colspan=2 valign="top" style="padding-top:10px;">
			<fieldset  class="ui-widget ui-widget-content">
			<legend><label id="lblGroup">Service Commission</label></legend>
			<div style="margin-top:5px;margin-left:10px;margin-bottom:10px;align:center;"> 
 				<table id="tbServiceCommission" cellspacing="1" width="98%" cellpadding="3" border="0" style="background-color:#f9f9f9;font-size:12px;border:0px solid #EAEAEA;">
 					<tbody style="font-weight:normal;background-color:#fff">
 					<tr>
 					<td>Doctor:</td>
 					<td><input type="text"   value="0" name="DocCommission" style="width:50%;padding:5px;font-size:12px;" maxlength=3  id="DocCommission" class="ui-widget-content ui-corner-all" />
 					<select  name="DocCommissionType"   id="DocCommissionType" class="ui-widget ui-widget-content ui-corner-left" style="width:6em;font-size:12px;">
							<option value="0">BAHT</option>
							<option value="1">%</option>
						</select></td>
 
 					
 					</tr>
 					<tr>
 					<td>Nurse:</td>
 					<td><input type="text" value="0" name="NurCommission" style="width:50%;padding:5px;font-size:12px;" maxlength=3  id="NurCommission" class="ui-widget-content ui-corner-all" />
 					<select  name="NurCommissionType"   id="NurCommissionType" class="ui-widget ui-widget-content ui-corner-left" style="width:6em;font-size:12px;">
							<option value="0">BAHT</option>
							<option value="1">%</option>
						</select>
 					</td>
 		 
 					</tr> 
					</tbody>
				</table>
				</div>
			</fieldset>
		</td>
		</tr>
	</table>
</form>
</div>
 <?php echo footer();?>